<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="yearCountForm">
		<div id="headDiv" class="box box-solid with-border">
			<div class="box-header" id="queryDiv">
				<p:outputLabel value="年份：" style="float:left;margin-top:5px" />
				<input type="text" id="countYearDept" onchange="changeDeptCountYearTable()"
					style="width: 80px; text-align: center; height: 30px" />
				<p:remoteCommand name="changeDeptCountYear"
					actionListener="#{deviceFaultCountController.changeDeptCountYear()}" />
				<p:outputLabel value="月份：" style="margin-left:20px"
					rendered="#{deviceFaultCountController.showYearCountTable}" />
				<h:selectOneMenu id="countStartMonth" style="width:80px;height:30px"
					value="#{deviceFaultCountController.startMonth}"
					rendered="#{deviceFaultCountController.showYearCountTable}">
					<f:selectItem itemLabel=" " itemValue="0" />
					<f:selectItem itemLabel="一月" itemValue="1" />
					<f:selectItem itemLabel="二月" itemValue="2" />
					<f:selectItem itemLabel="三月" itemValue="3" />
					<f:selectItem itemLabel="四月" itemValue="4" />
					<f:selectItem itemLabel="五月" itemValue="5" />
					<f:selectItem itemLabel="六月" itemValue="6" />
					<f:selectItem itemLabel="七月" itemValue="7" />
					<f:selectItem itemLabel="八月" itemValue="8" />
					<f:selectItem itemLabel="九月" itemValue="9" />
					<f:selectItem itemLabel="十月" itemValue="10" />
					<f:selectItem itemLabel="十一月" itemValue="11" />
					<f:selectItem itemLabel="十二月" itemValue="12" />
				</h:selectOneMenu>
				<p:outputLabel value="至" style="margin-left:5px;margin-right:5px"
					rendered="#{deviceFaultCountController.showYearCountTable}" />
				<h:selectOneMenu id="countEndMonth" style="width:80px;height:30px"
					value="#{deviceFaultCountController.endMonth}"
					rendered="#{deviceFaultCountController.showYearCountTable}">
					<f:selectItem itemLabel=" " itemValue="0" />
					<f:selectItem itemLabel="一月" itemValue="1" />
					<f:selectItem itemLabel="二月" itemValue="2" />
					<f:selectItem itemLabel="三月" itemValue="3" />
					<f:selectItem itemLabel="四月" itemValue="4" />
					<f:selectItem itemLabel="五月" itemValue="5" />
					<f:selectItem itemLabel="六月" itemValue="6" />
					<f:selectItem itemLabel="七月" itemValue="7" />
					<f:selectItem itemLabel="八月" itemValue="8" />
					<f:selectItem itemLabel="九月" itemValue="9" />
					<f:selectItem itemLabel="十月" itemValue="10" />
					<f:selectItem itemLabel="十一月" itemValue="11" />
					<f:selectItem itemLabel="十二月" itemValue="12" />
				</h:selectOneMenu>

				<p:outputLabel value="统计方式：" style="margin-left:20px"
					rendered="#{deviceFaultCountController.showYearCountTable}" />
				<h:selectOneMenu id="countTypeDept" style="width:120px;height:30px"
					rendered="#{deviceFaultCountController.showYearCountTable}"
					value="#{deviceFaultCountController.countTypeDept}">
					<f:selectItem itemLabel="按调度单位" itemValue="0" />
					<f:selectItem itemLabel="按检修范围" itemValue="1" />
				</h:selectOneMenu>

				<p:commandButton icon="ui-icon-search" value="查询"
					rendered="#{deviceFaultCountController.showYearCountTable}" oncomplete="initDataTable();"
					style="margin-left:10px;" update="faultCountDeptTb "
					actionListener="#{deviceFaultCountController.queryCountInfoByYearAndMonths}" />

				<p:outputLabel value="数据源：" style="margin-left:10px"
					rendered="#{!deviceFaultCountController.showYearCountTable}" />
				<h:selectOneMenu id="ds" style="width:100px;height:30px"
					rendered="#{!deviceFaultCountController.showYearCountTable}">
					<f:selectItem itemLabel="集中录波" itemValue="0" />
					<f:selectItem itemLabel="保护录波" itemValue="1" />
					<f:selectItem itemLabel="保护事件" itemValue="2" />
				</h:selectOneMenu>

				<p:commandButton icon="ui-icon-search" value="查询"
					rendered="#{!deviceFaultCountController.showYearCountTable}" style="margin-left:10px;"
					onclick="initFaultCountByYearChartData();" />

				<p:commandButton value="图形" style="float:right; margin-left:10px;"
					rendered="#{deviceFaultCountController.showYearCountTable}"
					actionListener="#{deviceFaultCountController.showYearCountChart}"
					oncomplete="showYearCountChart()" update="yearCountForm" />

				<p:commandButton value="表格" style="float:right; margin-left:10px;"
					rendered="#{!deviceFaultCountController.showYearCountTable}"
					actionListener="#{deviceFaultCountController.showYearCountTable}"
					oncomplete="initFaultCountChartDeptYear()" update="yearCountForm " />

				<p:commandButton value="导出excel" ajax="false"
					rendered="#{deviceFaultCountController.showYearCountTable}"
					actionListener="#{deviceFaultCountController.yearFileDownLoad}" icon="ui-icon-arrowthick-1-s">
					<p:fileDownload value="#{deviceFaultCountController.file}" />
				</p:commandButton>
			</div>
		</div>

		<p:dataTable id="faultCountDeptTb" var="item" emptyMessage="无记录"
			value="#{deviceFaultCountController.yearCountInfos}"
			rendered="#{deviceFaultCountController.showYearCountTable}" scrollable="true">
			<p:column headerText="单位" style="text-align:center" groupRow="true">
				<h:outputText value="#{item.deptName}" />
			</p:column>

			<p:column headerText="类型" style="text-align:center">
				<h:outputText value="#{item.type}" />
			</p:column>

			<p:columns value="#{deviceFaultCountController.months}" var="m" style="text-align:center">
				<f:facet name="header">
					<h:outputText value="#{m}月" />
				</f:facet>
				<p:commandLink value="#{(deviceFaultCountController.getCountDetail(m,item))[3]}%" title="点击查看详情"
					oncomplete="PF('countDetailDialog').show()" update="yearCountForm:panel"
					actionListener="#{deviceFaultCountController.getYearCountDetail1(m,item)}" />
			</p:columns>

		</p:dataTable>
		<p:dialog modal="true" header="故障信息上送详情" width="700" height="500" id="countDetail"
			widgetVar="countDetailDialog">
			<p:panelGrid style="width:100%" id="panel">
				<p:row>
					<p:column>
						<h:outputText value="上送率" />
					</p:column>
					<p:column>
						<h:outputText value="#{deviceFaultCountController.yearCountDetail[3]}%" />
					</p:column>
				</p:row>
				<p:row>
					<p:column>
						<h:outputText value="应评价次数" />
					</p:column>
					<p:column>
						<h:outputText value="#{deviceFaultCountController.yearCountDetail[0]}" />
					</p:column>
				</p:row>
				<p:row>
					<p:column>
						<h:outputText value="系统自动上送次数" />
					</p:column>
					<p:column>
						<h:outputText value="#{deviceFaultCountController.yearCountDetail[1]}" />
					</p:column>
				</p:row>
				<p:row>
					<p:column>
						<h:outputText value="人工上送次数" />
					</p:column>
					<p:column>
						<h:outputText value="#{deviceFaultCountController.yearCountDetail[2]}" />
					</p:column>
				</p:row>
			</p:panelGrid>
		</p:dialog>
		<div class="nav-tabs-custom" id="chartDiv" style="display: none;">
			<div class="tab-content no-padding" style="overflow: auto; height: 680px">
				<div class="col-xs-12">
					<div class="box box-primary">
						<div class="box-header with-border">
							<h4 id="desorgChartTitle" class='box-title' />
						</div>
						<div class="box-body">
							<div id="desorgChart"
								style="height: 350px; margin: 0 auto; text-align: center; color: grey; font-size: 16px; font-weight: bold" />
						</div>
					</div>
				</div>
				<div class="col-xs-12">
					<div class="box box-primary">
						<div class="box-header with-border">
							<h4 id="subcomChartTitle" class='box-title' />
						</div>
						<div class="box-body">
							<div id="subcomChart"
								style="height: 350px; margin: 0 auto; text-align: center; color: grey; font-size: 16px; font-weight: bold" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</h:form>
</ui:composition>
